<template>
  <div>
    <a :disabled="row.status === 'DISABLE'" @click="showConfirm">{{ text }}</a>
  </div>
</template>
<script>
import axios from 'axios'

export default {
  props: {
    text: { type: [String] },
    callback: { type: [Function] },
    row: { type: [Object], default: () => { return {} } },
  },
  data() {
    return {
    }
  },
  methods: {
    showConfirm() {
      let _this = this
      this.$confirm({
        title: this.$t('confirm_message'),
        content: '确认停用',
        okText: this.$t('confirm_yes'),
        okType: 'danger',
        cancelText: this.$t('confirm_no'),
        onOk() {
          _this.handleOk()
        },
      });
    },
    handleOk() {
      axios({
        method: 'post',
        url: '/backend/testMeta/disable',
        data: {
          id:this.row.id
        },
      }).then(() => {
        this.visible = false
        if(this.callback) {
          this.callback();
        }
      });
    },
  }
}
</script>
